{inc:header}
<div class="form-group">
	<a class="btn btn-default" href="?action=category&ctrl=add">+添加</a>
	<!-- IF[CREATHTML==1] --><a class="btn btn-default" href="?action=category&ctrl=createhtml">生成栏目静态</a><!-- end -->
	<a class="btn btn-default" href="?action=category&ctrl=updateurl" onclick="return confirm('确认重置URL？本操作将根据设定的url规则重新生成url')">重置URL</a>
	<a class="btn btn-default" href="?action=category&ctrl=createcache">生成栏目缓存</a>
</div>
<table class="table table-bordered">
	<tr>
		<th width="120">栏目</th>
		<th>介绍</th>
		<th width="60">状态</th>
        <th width="60">排序</th>
        <th width="60">ID</th>
        <th width="60">FID</th>
		<th width="140">操作</th>
	</tr>
    <!-- list:category|status=1 and fid=''|20|orders ASC-->
	<tr onmouseover="this.style.backgroundColor='#F4F4F4'" onmouseout="this.style.backgroundColor=''">
		<td>
            <a href="{$list['staticurl']}">{$list['name']}</a>
        </td>
		<td>{$list['intro']}</td>
		<td>{run:}echo Base::catstatus($list['status']);{/run}</td>
        <td>{$list['orders']}</td>
        <td>{$list['id']}</td>
        <td>{$list['fid']}</td>
		<td>
			<a href="?action=cms&ctrl=lists&cat={$list['id']}">文章</a>&nbsp;&nbsp;&nbsp;
			<a href="?action=category&id={$list['id']}&ctrl=edit">编辑</a>&nbsp;&nbsp;&nbsp;
			<a href="?action=category&id={$list['id']}&ctrl=del" onclick="return confirm('确认删除')">删除</a>
		</td>
	</tr>
    <?php
        $fid = $list['id'];
        $pre = '';
        $db=new Dbclass(SYS_ROOT.DB_NAME);
        $cat_child = $db->getlist(TB.'category','fid = '.$fid,'*');
        while (!empty($cat_child)) {
    ?>
    <!-- $cat_child as $row -->
    <?php $pre .= '─'; ?>
	<tr onmouseover="this.style.backgroundColor='#F4F4F4'" onmouseout="this.style.backgroundColor=''">
		<td>
            {$pre} <a href="{$row['staticurl']}">{$row['name']}</a>
        </td>
		<td>{$row['intro']}</td>
		<td>{run:}echo Base::catstatus($row['status']);{/run}</td>
        <td>{$row['orders']}</td>
        <td>{$row['id']}</td>
        <td>{$row['fid']}</td>
		<td>
			<a href="?action=cms&ctrl=lists&cat={$row['id']}">文章</a>&nbsp;&nbsp;&nbsp;
			<a href="?action=category&id={$row['id']}&ctrl=edit">编辑</a>&nbsp;&nbsp;&nbsp;
			<a href="?action=category&id={$row['id']}&ctrl=del" onclick="return confirm('确认删除')">删除</a>
		</td>
	</tr>
    <!-- end -->
    <?php $cat_child = $db->getlist(TB.'category','fid = '.$row['id'],'*'); ?>
    <?php } ?>
	<!-- END -->
</table>

<!-- 用于判断提示检测的方法$_i==0 --> 
<!-- IF[$_i==0] -->
<div style="clear:both;">抱歉，没有栏目，请先添加!</div>
<!-- END --> 
{inc:footer}